<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:display="http://www.w3.org/1999/xhtml"
      xmlns:div.display="http://www.w3.org/1999/xhtml" xmlns:row.display="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>还款录入</title>

    <!-- Bootstrap Core CSS -->
    <link th:href="@{/vendor/bootstrap/css/bootstrap.min.css}" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link th:href="@{/vendor/metisMenu/metisMenu.min.css}" rel="stylesheet">

    <!-- Custom CSS -->
    <link th:href="@{/dist/css/sb-admin-2.css}" rel="stylesheet">

    <!-- Custom Fonts -->
    <link th:href="@{/vendor/font-awesome/css/font-awesome.min.css}" rel="stylesheet" type="text/css">

    <!--bootstrap-table CSS-->
    <link th:href="@{vendor/bootstrap/css/bootstrap-table.css}" rel="stylesheet" type="text/css">

    <link th:href="@{/vendor/datepicker/datepicker3.css}" rel="stylesheet" type="text/css">

    <!-- jQuery -->
    <script th:src="@{/vendor/jquery/jquery.min.js}"></script>

    <!-- Bootstrap Core JavaScript -->
    <script th:src="@{/vendor/bootstrap/js/bootstrap.min.js}"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script th:src="@{/vendor/metisMenu/metisMenu.min.js}"></script>

    <!-- Custom Theme JavaScript -->
    <script th:src="@{/dist/js/sb-admin-2.js}"></script>

    <script th:src="@{/vendor/datepicker/bootstrap-datepicker.js}"></script>

    <!--bootstrap-table JavaScript-->
    <script th:src="@{vendor/bootstrap/js/bootstrap-table.js}"></script>

    <!--bootstrap-table中文 JavaScript-->
    <!--<script th:src="@{vendor/bootstrap/js/bootstrap-table-CN.js}"></script>-->

    <script>

        $(function () {
//            $("#save").click(function () {
//                var refno = $("#refno").val();
//                var custcod = $("#custcod").val();
//                var instnof = $("#instnof").val();
//                var instnot = $("#instnot").val();
//                var status = $("#status").val();
//                $.ajax({
//                    type: "POST",
//                    url: "/repaymentInput_insertCheck",
//                    contentType: "application/json",
//                    dataType: "html",
//                    data: JSON.stringify({
//                        refno: refno.toString(),
//                        custcod: custcod.toString(),
//                        instnof: instnof.toString(),
//                        instnot: instnot.toString(),
//                        status: status.toString()
//                    }),
//                    success: function (result) {
//                        return result;
//                    }
//                });
//            });

            if ($('#refno').val().replace(/(^\s*)|(\s*$)/g, "") != '') {
                $.ajax({
                    type: 'get',
                    url: '/repaymentInput/getSearchInfo?refno=' + $('#refno').val(),
                    contentType: 'application/json',
                    success: function (data) {
                        $('#refno').val(data.refno);
                        $('#custcod').val(data.custcod);
                        $('#cusnm').val(data.cusnm);
                    },
                    error: function () {
                        alert("获取客户数据失败");
                    }
                })
            }

            var refno = $('#refno').val();
            $.ajax({
                type: 'POST',
                url: '/repaymentInput_getPayamt',
                contentType: 'application/json',
                dataType: "html",
                data: JSON.stringify({
                    refno: refno.toString()
                }),
                success: function (result) {
                    $("#payamt").val(result);
                },
                error: function () {
                    alert("获取还款金额失败");
                }
            });

            var schetyp = $("#schetyp").val();
            $.ajax({
                type: 'POST',
                url: '/repaymentInput_QueryBySchetyp',
                contentType: 'application/json',
                dataType: "html",
                data: JSON.stringify({
                    schetyp: schetyp.toString()
                }),
                success: function (result) {
                    $("#schedes").val(result);
                },
                error: function () {
                    alert("获取方案类型描述失败");
                }
            });

//            var setord1 = $('#setord1').val();
//            var setord2 = $('#setord2').val();
//            var setord3 = $('#setord3').val();
//            var setord4 = $('#setord4').val();
//            alert(typeof(setord1));
//            alert($("#setord2").find("option[value=setord1]").val());
//            $('#setord1').change(function () {
//                $("#setord2").find("option[value='2']").attr("disabled","disabled").css("background-color","#EEEEEE;");
//                $("#setord3").find("option[value='2']").attr("disabled","disabled").css("background-color","#EEEEEE;");
//                $("#setord4").find("option[value='2']").attr("disabled","disabled").css("background-color","#EEEEEE;");
//            });

            $('#exit').click(function () {
                if (navigator.appName == "Netscape") {
                    window.location.href = 'about:blank ';
                } else if (navigator.appName == "Firefox") {
                    window.location.href = 'about:blank ';
                }
                else {
                    window.close();
                }
            });
        })





    </script>

</head>

<body>

<div id="repaymentInput">
    <div class="col-lg-12" >
        <form id="repaymentInfo" th:action="@{/repaymentInput(refno=${refno},custcod=${custcod},instnof=${instnof},instnot=${instnot},status=${status})}" th:object="${repaymentInput_entity}" method="post" onsubmit="beforeSubmit()">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">
                        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">还款录入</a>
                        <button type="submit" id="save" class="btn btn-primary">保  存</button>
                        <button id="exit" type="button" class="btn btn-primary">退  出</button>
                    </h4>
                </div>
                <div id="collapseOne" class="panel-collapse collapsein">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>业务编号:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{refno}" name="refno" maxlength="13" id="refno" readonly>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>客户号:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{custcod}" name="custcod" maxlength="12" id="custcod" readonly>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>客户名:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{cusnm}" name="cusnm" maxlength="50" id="cusnm" readonly>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>合同号:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{custref}" name="custref" maxlength="20" id="custref" readonly>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>方案类型:</label>
                                </div>
                                <div class="col-lg-8">
                                    <div class="col-lg-6">
                                        <input class="form-control" th:field="*{schetyp}" name="schetyp" maxlength="3" id="schetyp" readonly>
                                    </div>
                                    <div class="col-lg-6">
                                        <input class="form-control" th:field="*{schedes}" name="schedes" maxlength="50" id="schedes" readonly>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>融资金额:</label>
                                </div>
                                <div class="col-lg-8">
                                    <div class="col-lg-6">
                                        <input class="form-control" th:field="*{lnccy}" name="lnccy" maxlength="3" id="lnccy" readonly>
                                    </div>
                                    <div class="col-lg-6">
                                        <input class="form-control" th:field="*{lnamt}" name="lnamt" maxlength="15" id="lnamt" readonly>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>融资余额:</label>
                                </div>
                                <div class="col-lg-8">
                                    <div class="col-lg-6">
                                        <input class="form-control" th:field="*{lnosccy}" name="lnosccy" maxlength="3" id="lnosccy" readonly>
                                    </div>
                                    <div class="col-lg-6">
                                        <input class="form-control" th:field="*{lnosamt}" name="lnosamt" maxlength="15" id="lnosamt" readonly>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>期数:</label>
                                </div>
                                <div class="col-lg-8">
                                    <div class="col-lg-6">
                                        <input class="form-control" th:field="*{instnof}" name="instnof" maxlength="4" id="instnof" readonly>
                                    </div>-
                                    <div class="col-lg-6">
                                        <input class="form-control" th:field="*{instnot}" name="instnot" maxlength="4" id="instnot" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>结算周期（1-4）</label>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>本金金额:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{prinamt}" name="prinamt" maxlength="15" id="prinamt" readonly>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <select class="form-control" th:field="*{setord1}" id="setord1" name="setord1" th:selected="*{setord1}" required>
                                        <option value="4">4</option>
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>分期利息:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{intamt}" name="intamt" id="intamt" maxlength="15" readonly>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <select class="form-control" th:field="*{setord2}" id="setord2" name="setord2" th:selected="*{setord2}" required>
                                        <option value="3">3</option>
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="4">4</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>逾期利息:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{odintamt}" name="odintamt" readonly id="odintamt" maxlength="15">
                                    <div th:if="${#fields.hasErrors('odintamt')}" th:errors="*{odintamt}" class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <select class="form-control" th:field="*{setord3}" id="setord3" name="setord3" th:selected="*{setord3}" required>
                                        <option value="2">2</option>
                                        <option value="1">1</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>调整金额:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{odadjamt}" name="odadjamt" id="odadjamt" maxlength="15">
                                    <div th:if="${#fields.hasErrors('odadjamt')}" th:errors="*{odadjamt}" class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>复合利息:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" row="3" th:field="*{compint}" name="compint" id="compint" maxlength="15">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>逾期罚息:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{latechg}" name="latechg" maxlength="15" id="latechg" readonly>
                                    <div th:if="${#fields.hasErrors('latechg')}" th:errors="*{latechg}" class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-6">
                                    <div class="col-lg-4">
                                        <select class="form-control" th:field="*{setord4}" id="setord4" name="setord4" th:selected="*{setord4}" required>
                                            <option value="1">1</option>
                                            <option value="2">2</option>
                                            <option value="3">3</option>
                                            <option value="4">4</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>调整金额:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{lchgadj}" name="lchgadj" id="lchgadj" maxlength="15">
                                    <div th:if="${#fields.hasErrors('lchgadj')}" th:errors="*{lchgadj}" class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>保证金还款:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input type="checkbox" class="form-control" th:field="*{margflag}" name="margflag" maxlength="6" id="margflag">
                                    <div th:if="${#fields.hasErrors('margflag')}" th:errors="*{margflag}" class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>还款金额:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{payamt}" name="payamt" id="payamt" maxlength="15">
                                    <div th:if="${#fields.hasErrors('payamt')}" th:errors="*{payamt}" class="alert alert-danger">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row" style="display:none;">
                            <div class="col-lg-6">
                                <div class="col-lg-4">
                                    <label>状态:</label>
                                </div>
                                <div class="col-lg-8">
                                    <input class="form-control" th:field="*{status}" name="status" id="status" maxlength="15">
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>


            <!--<div class="row">-->
                <!--<div class="col-lg-4"></div>-->
                <!--<div class="col-lg-4" align="center">-->
                    <!--<button type="reset" class="btn btn-primary">重填</button>-->
                    <!--<button type="submit" class="btn btn-primary">保存</button>-->
                <!--</div>-->
                <!--<div class="col-lg-4"></div>-->
            <!--</div>-->

        </form>
    </div>
</div>



</body>

</html>
